#!/bin/bash
current_dir=`pwd`
if [ -d ./build ];then
	rm -rf ./build
fi
mkdir ./build

gitversion=`  git log --format=%h  | head -n 1 |  awk -F ' ' '{print $1}'`
echo $gitversion
tagversion=`cat package.json | json  .version`
version=`echo $tagversion.$gitversion`
echo $version;
cp ./package.json ./package.json.bak
json -I -f package.json  -e "this.version=\"$version\""
cd ..
nwbuild  -p osx64 -v 0.12.3 -o /tmp/bz_build --macIcns ./bz_autotest/app.icns  ./bz_autotest
cd $current_dir
cp -r /tmp/bz_build/BzAutoTest/osx64/BzAutoTest.app ./build/
mv ./build/BzAutoTest.app ./build/泊志PX4自动测试.app
cp ./package.json.bak ./package.json
rm ./package.json.bak
